package com.cskaoyan.service.admin;

import com.cskaoyan.mapper.MarketGoodsMapper;
import com.cskaoyan.mapper.MarketOrderMapper;
import com.cskaoyan.mapper.MarketUserMapper;
import com.cskaoyan.model.admin.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName: StatServiceImpl
 * @Author: WangEnzhao
 * @Description: 统计报表模块业务层实现
 * @CreateTime: 2021/11/11:44:00
 */
@Service
public class StatServiceImpl implements StatService{
    @Autowired
    MarketUserMapper marketUserMapper;

    @Autowired
    MarketOrderMapper marketOrderMapper;

    @Autowired
    MarketGoodsMapper marketGoodsMapper;

    /**
    * @Author: WangEnzhao
    * @Description: 查询统计用户模块
    * @CreateTime:
    * @Param:
    * @return:
    **/
    @Override
    public StatUserRespVO selectStatUser() {
        List<RowsEntityOfStatUserRespVO> rowsEntityOfStatUserRespVOS = marketUserMapper.selectUsersCountByTime();
        StatUserRespVO statUserRespVO = new StatUserRespVO();
        statUserRespVO.setRows(rowsEntityOfStatUserRespVOS);
        return statUserRespVO;
    }

    /**
    * @Author: WangEnzhao
    * @Description: 查询统计订单模块
    * @CreateTime:
    * @Param:
    * @return:
    **/
    @Override
    public StatOrderRespVO selectStatOrder() {
        List<RowsEntityOfStatOrderRespVO> rowsEntityOfStatOrderRespVOS = marketOrderMapper.selectStatOrder();
        StatOrderRespVO statOrderRespVO = new StatOrderRespVO();
        statOrderRespVO.setRows(rowsEntityOfStatOrderRespVOS);
        return statOrderRespVO;
    }

    @Override
    public StatGoodsRespVO selectStatGoods() {
        List<RowsEntityOfStatGoodsRespVO> rowsEntityOfStatGoodsRespVOS = marketGoodsMapper.selectStatGoods();
        StatGoodsRespVO statGoodsRespVO = new StatGoodsRespVO();
        statGoodsRespVO.setRows(rowsEntityOfStatGoodsRespVOS);
        return statGoodsRespVO;
    }
}
